// pages/auth/auth.js

Page({
  /**
   * 页面的初始数据
   */
  data: {},
  // 获取授权
  async handlgetUserInfo(e) {
    wx.setStorageSync("token","Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo")
    // 订单

    // 地址
    const { encryptedData, rawData, iv, signature } = e.detail;
    let code = await this.login();




    // wx.requestPayment({
    //   timeStamp: "1564730510",
    //   nonceStr: "SReWbt3nEmpJo3tr",
    //   package: "prepay_id=wx02152148991420a3b39a90811023326800",
    //   signType: "MD5",
    //   paySign: "3A6943C3B865FA2B2C825CDCB33C5304",
    //   success (res) {console.log(res) },
    //   fail (res) { console.log(res)}
    // })
    // return

  },

  login() {
    return new Promise((resolve, reject) => {
      wx.login({
        success(res) {
          resolve(res.code);
        },
      });
    });
  }
});
